<!DOCTYPE HTML>
<html>
  <head>
    <title>Bootstrap 101 Template</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap -->
    <link href="{$Think.const.COMMON_URL}/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link rel="stylesheet" href="{$Think.const.COMMON_URL}/css/font-awesome.min.css">
    <link rel="stylesheet" href="{$Think.const.ADMIN_CSS_URL}/movie.css">
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
  </head>
  <body>
  <!-- 图片预览框 -->
  <div id="showpic" class="showpic" style="display:none;"><img name="showpic_img" id="showpic_img" width="120" height="160"></div>
   <form action="{:U('moviemanage/movie_edit_post')}" method="post" id="ajax_img">
    <table class="table table-bordered">
      <tr><th>添加视频:</th><th><a class='ma_top' href="{:U('admin/moviemanage/movielist')}">电影管理</a></th></tr>
      <tr><td>电影名称:</td><td><input type="text" name="v_title" value="{$v_title}">&nbsp;&nbsp;所属分类:
        <input type="hidden" name="v_id" value="{$v_id}">
        <select class="ma_term" name="v_pid">
          <option value="">选择所属分类</option>
		  {$treelist}
		</select>
		&nbsp;&nbsp;头条：
		<select class="ma_address" name="v_head">
		  <option value='0' <if condition="$v_head eq '0'">selected</if>>不推荐</option>
		  <option value='1' <if condition="$v_head eq '1'">selected</if>>推荐</option>
		</select>
		&nbsp;&nbsp;推荐:
		<select class="ma_address" name="v_recommend">
		  <option value='0' <if condition="$v_recommend eq '0'">selected</if>>不推荐</option>
		  <option value='1' <if condition="$v_recommend eq '1'">selected</if>>推荐</option>
		</select>
	    </td>
	  </tr>
	  <tr><td>电影导演：</td><td><input type="text" name="v_actor" value="{$v_actor}">
	    &nbsp;&nbsp;影片产地:
		<select class="ma_address" name="v_area">
		  <option>出产地区</option>
		  <option value="大陆" <if condition="$v_area eq '大陆' ">selected</if>>大陆</option>
		  <option value="香港" <if condition="$v_area eq '香港' ">selected</if>>香港</option>
		  <option value="台湾" <if condition="$v_area eq '台湾' ">selected</if>>台湾</option>
		  <option value="美国" <if condition="$v_area eq '美国' ">selected</if>>美国</option>
		</select>
	  &nbsp;&nbsp;更新到第几集：<input class="ma_js" type="text" name="v_episodes" value="{$v_episodes}"></td></tr>
	  <tr><td>电影主演：</td><td><input type="text" name="v_director" value="{$v_director}">&nbsp;&nbsp;上映时间：<input type="text" class="ma_time" name="v_time" value="{$v_time}">&nbsp;&nbsp;下载几次：<input type="text" class="ma_time" name="v_downc" value="{$v_downc}"></td></tr>
	  <tr>
	    <td>海报剧照：</td>
	    <td>
	      <input type="text" name="v_pic" onmouseover="if(this.value)showpic(event,this.value,'Uploads/');" onMouseOut="hiddenpic();" value="{$v_pic}">&nbsp;&nbsp;&nbsp;<div class="input-prepend">
	      <a onclick="img_file.click()" class="btn btn-info">选择图片</a>
    	  <input type="text" class="btn" id="img_name" >
	      <input type="file" name="img" style="display:none;" id="img_file" onchange="img_name.value=this.value">
	      <a class="btn" onclick="ajaxsubmitimg()">上传</a>
          </div>           
        </td>
      </tr>
      <tr><td>字母导航:</td><td><input type="text" name="v_infozm" value="{$v_infozm}">&nbsp;&nbsp;豆瓣评分：<input type="text" name="v_grade" value="{$v_grade}" ></td></tr>
      <tr><td>预告播放地址:</td><td><input type="text" name="v_advanceurl" value="{$v_advanceurl}"></td></tr>
      <tr><td>电影简介:</td><td><textarea rows="3"style="width:400px;" name="v_brief" >{$v_brief}</textarea></td></tr>
	    <tbody>  
	      <tr>
	        <td>下载地址1:
	          <select name="v_downterm1">
	            <option value='迅雷下载' <if condition="$v_downterm1 == '迅雷下载' ">selected</if>>迅雷下载</option>
	            <option value='磁力链接' <if condition="$v_downterm1 == '磁力链接' ">selected</if>>磁力链接</option>
	          </select>
	          <br/><h6>名称与||||下载代码用隔开 不同集数之间用$$$隔开</h6>
	          <br/>扩张数量<input type="text" id="addnum1" style="width:40px;"> <a class="btn" title='1' onclick="add_downurl(this.title)">输出</a>
	        </td>
	        <td>
	          <table class="addtable" id="addtable1">
	             <tr><th>下载名称</th><th>下载地址</th></tr>
	             <foreach name="nameurl1" item="vo">
	                <tr><td><input type="text" name="downpath1_1[]" value="{$vo['name']}"></td><td><input type="text" name="downpath1_2[]" value="{$vo['url']}"></td></tr>
	             </foreach>
	          </table>
	        </td>
	      </tr>
	   </tbody>
	   <tbody>  
	      <tr>
	        <td>下载地址2:
	          <select name="v_downterm2">
	            <option value='迅雷下载' <if condition="$v_downterm2 == '迅雷下载' ">selected</if>>迅雷下载</option>
	            <option value='磁力链接' <if condition="$v_downterm2 == '磁力链接' ">selected</if>>磁力链接</option>
	          </select>
	          <br/><h6>名称与||||下载代码用隔开 不同集数之间用$$$隔开</h6>
	          <br/>扩张数量<input type="text" id="addnum2" style="width:40px;"> <a class="btn" title='2' onclick="add_downurl(this.title)">输出</a>
	        </td>
	        <td>
	          <table class="addtable" id="addtable2">
	             <tr><th>下载名称</th><th>下载地址</th></tr>
	             <foreach name="nameurl2" item="vo">
	                <tr><td><input type="text" name="downpath2_1[]" value="{$vo['name']}"></td><td><input type="text" name="downpath2_2[]" value="{$vo['url']}"></td></tr>
	             </foreach>
	          </table>
	        </td>
	      </tr>
	   </tbody>
	   <tbody>  
	      <tr>
	        <td>下载地址3:
	          <select name="v_downterm3">
	            <option value='迅雷下载' <if condition="$v_downterm3 == '磁力链接' ">selected</if>>迅雷下载</option>
	            <option value='磁力链接' <if condition="$v_downterm3 == '磁力链接' ">selected</if>>磁力链接</option>
	          </select>
	          <br/><h6>名称与||||下载代码用隔开 不同集数之间用$$$隔开</h6>
	          <br/>扩张数量<input type="text" id="addnum3" style="width:40px;"> <a class="btn" title='3' onclick="add_downurl(this.title)">输出</a>
	        </td>
	        <td>
	          <table class="addtable" id="addtable3">
	             <tr><th>下载名称</th><th>下载地址</th></tr>
	             <foreach name="nameurl3" item="vo">
	                <tr><td><input type="text" name="downpath3_1[]" value="{$vo['name']}"></td><td><input type="text" name="downpath3_2[]" value="{$vo['url']}"></td></tr>
	             </foreach>
	          </table>
	        </td>
	      </tr>
	   </tbody>
     
      <tr><td colspan="2"><center><input type="submit" class="btn btn-success" name="submit" value="提交">&nbsp;&nbsp;<input type="reset" class="btn btn-warning" name="reset" value="重置"></center></td></tr>
    </table>
    </form>
    <script src="{$Think.const.COMMON_URL}/js/jquery-1.7.2.min.js"></script> 
    <script src="{$Think.const.COMMON_URL}/js/bootstrap.js"></script>
    <script src="{$Think.const.ADMIN_JS_URL}/admin.js"></script>
    <script type="text/javascript">
    //ajax将图片上传到服务器
    function ajaxsubmitimg(){
    	var reg = document.getElementById('ajax_img');
    	//html5建一个对象存储表单信息
    	var fd = new FormData(reg);    
    	//创建ajax对象
    	var xhr = new XMLHttpRequest();
    	xhr.onreadystatechange=function(){
    		if(xhr.readyState==4 && xhr.status==200){
    			var info = xhr.responseText.split(',');
    			var img_url = '//localhost/zjqvcms/uploads/movie/'+info['1'];
    			$('[name=v_pic]').val(img_url);
    		}
    	};
    	xhr.open('post','/zjqvcms/index.php/admin/moviemanage/ajax_img.html');
    	xhr.send(fd);
     }
    </script>
  </body>